﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.IO
{
  public static class BinaryWriterExtensions
  {
    public static void WriteCollection<T>(this BinaryWriter writer, IEnumerable<T> data, Action<T> action)
    {
      writer.Write(data.Count());
      foreach (var obj in data)
        action(obj);
    }
  }
}
